<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
	<title>个人公司详情</title>
	<link rel="stylesheet" type="text/css" href="../../css/aui-win.css">
	<style type="text/css">
	*{
		margin: 0;
		padding:0;
	}
	body{
		background: white;
	}
		.header{
			height: 45px;
			background: #00abfd;
			line-height: 45px;
			text-align: center;
			width: 100%;
		}
		ul{
			width: 100%;
			background: white;
		}
		li{
			height: 40px;
			width: 90%;
			list-style: none;
			margin: 10px 0 0 5%;
		}
		li p{
			height: 40px;
			width: 28%;
			float: left;
			line-height: 40px;
		}
		li input{
			height: 38px;
			width: 58%;
			float: left;
			padding-right: 20px;
			border-bottom:1px solid #999;
			background: none;
			padding-left: 1%;
		}
		li select{
			width: 40%;
			float: left;
			height: 23px;
			margin-top: 8px;

			background: none;
		}
		textarea{
			width: 80%;
			height: 140px;
			margin-left: 5%;
			margin-top: 10px;
			padding:10px 5% 10px 5%; 
			background: #e6e6e6;
		}
		p span{
			color: white;
		}
		h3{
			height: 40px;
			background: #e3e3e3;
			font-size: 18px;
			font-weight: bold;
			line-height: 40px;
			padding-left: 20px;
			margin-top: 10px;
		}
		#baocun{
			position: absolute;
			right: 15px;
			top: 0;
			background:none;
			color: white;
			font-size:0.9rem;
		}
		#myheadimg{
			margin-top: 8px;
		}
		.main{
		position:fixed;
		top:45px;
		width:100%;
		overflow:scroll;
		height:100%;
	}
	</style>
</head>
<body>
	<header class="aui-bar aui-bar-nav aui-bar-yunzo" id="aui-header">
		<a class="aui-btn aui-bar-yunzo aui-pull-left" id="back" onclick="back_go()"> <span class="aui-iconfont aui-icon-left"></span></a>
		<div class="aui-title" id="title">
			公司详情
		</div>
		<a class="aui-iconfont aui-icon-menu aui-pull-right"></a>
		<input type="button" value="保存" onclick="preservation()" id="baocun">
	</header>
	<div class="margin_div"></div>
	<article class="main"  id="wrapper">
	<ul>
		<li><p>公司名称</p><input type="text" id="comname"></li>
		<li><p>担任职务：</p>
			<select id="comduty">
				
			</select>
		</li>
		<li><p>公司性质</p><select id="comproperty">
				
			</select></li>
		<li><p>公司规模</p><select id="comscale">
				
			</select></li>
		<li><p>行<span>空空</span>业</p><select id="comindustry">

			</select></li>
		<li><p>电<span>空空</span>话</p><input type="text" id="comtellphone"></li>
		<li><p>邮<span>空空</span>箱</p><input type="text" id="comemail"></li>
		<li><p>地<span>空空</span>址</p><input type="text" id="comaddress"></li>
		<li><p>网<span>空空</span>址</p><input type="text" id="comurl"></li>
		<li><p>电商网址</p><input type="text" id="comecurl"></li>
		<!--<li><p class="text_p">公司Logo</p><input type="file" id="myheadimg" accept="image/*;capture=camera" name="myheadimg" style="border: none;"></li>-->
	</ul>
	<h3>
		公司介绍
	</h3>
	<textarea id="comment">
		
	</textarea>
	</article>
	<script type="text/javascript" src="../../script/jquery-1.10.2.min.js"></script>
	<script type="text/javascript" src="../../script/common.js"></script>
    <script>
    var b;
    var str_comindustry="";
	var str_comduty="";
	var str_comproperty="";
	var str_comscale="";
	for(var i=0;i<arr_industry.length;i++){
		str_comindustry+="<option>"+arr_industry[i]+"</option>"
	}
	$("#comindustry").html(str_comindustry);
	for(var i=0;i<arr_comduty.length;i++){
		str_comduty+="<option>"+arr_comduty[i]+"</option>"
	}
	$("#comduty").html(str_comduty);
	for(var i=0;i<arr_comproperty.length;i++){
		str_comproperty+="<option>"+arr_comproperty[i]+"</option>"
	}
	$("#comproperty").html(str_comproperty);
	for(var i=0;i<arr_comscale.length;i++){
		str_comscale+="<option>"+arr_comscale[i]+"</option>"
	}
	$("#comscale").html(str_comscale);
    var comid=getUrlParam("infoid");

     var bodyparam={
            mid:$mid,
            groupid:$groupid,
            did:initdata.get('mycompany'),
            comid:comid
        };
     
        ajaxcocRequest("../../../api/group/getmembercompanyinfobycid","POST",bodyparam,function(msg){
            if(msg.code==100){
            //	alert(JSON.stringify(msg));
       			$("#comname").val(msg.datum.n2)
       			$("#comproperty").val(msg.datum.n4);
       			$("#comment").val(msg.datum.n11);
       			$("#comscale").val(msg.datum.n5);
       			$("#comindustry").val(msg.datum.n6);
       			$("#comtellphone").val(msg.datum.n7);
       			$("#comemail").val(msg.datum.n8);
       			$("#comaddress").val(msg.datum.n9);
       			$("#comurl").val(msg.datum.n10);
       			$("#comecurl").val(msg.datum.n13);
            }
            else{
            	$("body").append('<div class="wuwang"><img src="../../image/iconfont-wangluo.png"><p>网络拥堵，信息塞车</p></div>')
            }
            
        })
        $("#comname").blur(function(){
		if($("#comname").val()!=""&&$("#comname").val().length<=15){
			b=true;
			$("#comname").css("background","url(../../image/my/dui.png)")
			$("#comname").css("background-repeat","no-repeat");
			$("#comname").css("background-position","100% 0");
		}
		else{
			b=false;
			$("#comname").css("background","url(../../image/my/cuo.png)")
			$("#comname").css("background-repeat","no-repeat");
			$("#comname").css("background-position","100% 0");
		}
	})
	/*-----------------以上部分验证公司名称----------------------------*/
	$("#comtellphone").blur(function(){
		var re=/^[0-9]{10,12}$/;
		if(re.test($("#comtellphone").val())!=false){
			b=true;
			$("#comtellphone").css("background","url(../../image/my/dui.png)")
			$("#comtellphone").css("background-repeat","no-repeat");
			$("#comtellphone").css("background-position","100% 0");
		}
		else if($("#comtellphone").val()==""){
			b=true;
			$("#comtellphone").css("background","none")
		}
		else{
			b=false;
			$("#comtellphone").css("background","url(../../image/my/cuo.png)")
			$("#comtellphone").css("background-repeat","no-repeat");
			$("#comtellphone").css("background-position","100% 0");
		}
	})
	/*----------------------以上部分验证电话------------------------*/
	$("#comemail").blur(function(){

		var re=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if(re.test($("#comemail").val())!=false){
			b=true;
			$("#comemail").css("background","url(../../image/my/dui.png)")
			$("#comemail").css("background-repeat","no-repeat");
			$("#comemail").css("background-position","100% 0");
		}
		else if($("#comemail").val()==""){
			b=true;
			$("#comemail").css("background","none")
		}
		else{
			b=false;
			$("#comemail").css("background","url(../../image/my/cuo.png)")
			$("#comemail").css("background-repeat","no-repeat");
			$("#comemail").css("background-position","100% 0");
		}
	})
	/*--------------------以上验证邮箱---------------------------*/
	$("#comaddress").blur(function(){
		if($("#comaddress").val().length<=20&&$("#comaddress").val()!=""){
			b=true;
			$("#comaddress").css("background","url(../../image/my/dui.png)");
			$("#comaddress").css("background-repeat","no-repeat");
			$("#comaddress").css("background-position","100% 0");
		}
		else if($("#comaddress").val()==""){
			b=true;
			$("#comaddress").css("background","none")
		}
		else{
			b=false;
			$("#comaddress").css("background","url(../../image/my/cuo.png)")
			$("#comaddress").css("background-repeat","no-repeat");
			$("#comaddress").css("background-position","100% 0");
		}
	})
	/*--------------------------以上验证公司地址----------------------------*/
	$("#comment").blur(function(){

		if($("#comment").val().length>=10){
			b=true;
			$("#comment").css("background","url(../../image/my/dui.png)")
			$("#comment").css("background-repeat","no-repeat");
			$("#comment").css("background-position","100% 0");
		}
		else if($("#comment").val()==""){
			$("#comment").css("background","none")
			b=true;
		}
		else{
			b=false;
			$("#comment").css("background","url(../../image/my/cuo.png)")
			$("#comment").css("background-repeat","no-repeat");
			$("#comment").css("background-position","100% 0");
		}
	})

        //修改内容
function preservation(){
        	if(b==true){
        		 uploadComplete();
        	}
        	else{
        		alert("您输入的信息不完整！请全部填写！")
        	}
}
    /*    $("#myheadimg").change(function(){
    	fileSelected();
    });
 function fileSelected() {
        var file = document.getElementById('myheadimg').files[0];
        if (file) {
        	var url=getObjectURL(file);
        }
      }
 function uploadFile() {
        var fd = new FormData();
        fd.append("myheadimg", document.getElementById('myheadimg').files[0]);
        var xhr = new XMLHttpRequest();
       	xhr.upload.addEventListener("progress", uploadProgress, false);
        xhr.addEventListener("load", uploadComplete, false);
        xhr.addEventListener("error", uploadFailed, false);
        xhr.addEventListener("abort", uploadCanceled, false);
        xhr.open("POST", "../../../api/file/upload");
        xhr.send(fd);
      }

      function uploadProgress(evt) {
        if (evt.lengthComputable) {
          var percentComplete = Math.round(evt.loaded * 100 / evt.total);
          //document.getElementById('progressNumber').innerHTML = percentComplete.toString() + '%';
        }
        else {
        //  document.getElementById('progressNumber').innerHTML = 'unable to compute';
        }
      }
*/
      function uploadComplete(/*evt*/) {
      	var comName=$("#comname").val();
		var comduty=$("#comduty").val();
		var comproperty=$("#comproperty").val();
		var comscale=$("#comscale").val();
		var comindustry=$("#comindustry").val();
		var comtellphone=$("#comtellphone").val();
		var comemail=$("#comemail").val();
		var comaddress=$("#comaddress").val();
		var comurl=$("#comurl").val();
		var comecurl=$("#comecurl").val();
		var comment=$("#comment").val();
		var togroupid=$groupid;
		var groupname=$groupname;
		var comlogo;

    	 var bodyParam={
  	            "mid":$mid,
            	"groupid":$groupid,
            	"did":initdata.get('mycompany'),
            	"comlogo":/*obj.datum.myheadimg*/comlogo,
            	"comname":comName,
            	"comduty":comduty,
            	"comproperty":comproperty,
            	"comscale":comscale,
            	"comindustry":comindustry,
            	"comtellphone":comtellphone,
            	"comemail":comemail,
            	"comaddress":comaddress,
            	"comurl":comurl,
            	"comecurl":comecurl,
            	"comment":comment,
            	"togroupid":togroupid,
            	"togroupname":groupname,
            	"comid":comid
  	        };
             ajaxCoCRequest("../../../api/account/editmycompanyinfo", "POST", bodyParam, function(msg){
                 if(msg.code==100){
            		alert("修改成功");
                 }else{
                	 $("body").append('<div class="wuwang"><img src="../../image/iconfont-wangluo.png"><p>网络拥堵，信息塞车</p></div>')
                 }
                
             });
      }

  /*    function uploadFailed(evt) {
    	  alert("图片上传失败,请重新选择图片!");
      }

      function uploadCanceled(evt) {
        alert("上传已经取消,请重新选择图片!");
      }
function getObjectURL(file) {
      	var url = null ; 
      	if (window.createObjectURL!=undefined) { // basic
      		url = window.createObjectURL(file) ;
      	} else if (window.URL!=undefined) { // mozilla(firefox)
      		url = window.URL.createObjectURL(file) ;
      	} else if (window.webkitURL!=undefined) { // webkit or chrome
      		url = window.webkitURL.createObjectURL(file) ;
      	}
      	return url ;
      }*/
    </script>
</body>
</html>